<?php 

global $db;
$cart = new Cart();
$cart_list = $cart->get_all();
$book_list = array();
		
foreach ($cart_list as $book){
		$book_list[] = array("id"=> $book['id'] , "num_copies" => $book['num_copies']);
}
		
extract($request);
setlocale(LC_TIME, "it_IT.utf8");
?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">

<!-- Mirrored from themes.voodoo-pixel.com/skate/index-2.html by HTTrack Website Copier/3.x [XR&CO'2010], Fri, 16 Dec 2011 13:45:35 GMT -->
<head>

<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<meta name="keywords" content="" />
<meta name="description" content="" />

<!--Title of your website-->
<title>Mercatino dei Libri Usati</title>




<!--Java Script-->


</head>
<!--Body-->
<body style="font-size: 12px; color: #282828; font-family: Arial, Helvetica, sans-serif; background-color: #FFFEF9; line-height: 1.5em; background-image: url(../images/style-1/backgrounds/bg-1.jpg); background-repeat: repeat; margin: 0;" bgcolor="#FFFEF9"> <!--CSS Styles-->

<!--Wrapper-->
<div id="email-wrapper" style="width: 600px; margin: 0 auto;">

<!--Header-->
	<div id="email-header">
  
<!--Logo-->
	<div id="email-logo"> 
	<a href="index.php">
	<img src="<?=site_url()?>images/mercatinologo.jpg"  alt="Logo Mercatino" style="width: 600px;" />
	</a>
	</div>
    

	
	</div>


<div id="email-content" style="padding: 10px; background-color: white; margin-top: 20px; min-height: 300px;">

	<?php if ( $is_admin):?>
		<h1 style="font-size: 20px; font-family: 'BebasNeueRegular'; font-weight: normal; margin: 0 0 10px; padding: 0px;">
		Dettagli ordine</h1>
	
		<div class="contact_info" style="width: 280px; float: left;">
			<h6 style="font-size: 15px; margin: 0 0 10px;">Nome:</h6>
			<p style="line-height: 1.5em; margin: 0 0 10px;"><?php echo $name." ".$surname;?></p>
			<h6 style="font-size: 15px; margin: 0 0 10px;">Email</h6>
			<p style="line-height: 1.5em; margin: 0 0 10px;"><?=$email?></p>
			<h6 style="font-size: 15px; margin: 0 0 10px;">Contatti</h6>
			<p style="line-height: 1.5em; margin: 0 0 10px;"><?php echo $phone." - ".$mobile;?></p>
			<h6 style="font-size: 15px; margin: 0 0 10px;">Codice fiscale/Partita IVA</h6>
			<p style="line-height: 1.5em; margin: 0 0 10px;"><?=$tax_code?></p>
		</div>
		<div class="contact_info" style="width: 280px; float: left;">	
			<h6 style="font-size: 15px; margin: 0 0 10px;">Città</h6>
			<p style="line-height: 1.5em; margin: 0 0 10px;"><?=$city?></p>
			<h6 style="font-size: 15px; margin: 0 0 10px;">Cap</h6>
			<p style="line-height: 1.5em; margin: 0 0 10px;"><?=$cap?></p>
			<h6 style="font-size: 15px; margin: 0 0 10px;">Indirizzo</h6>
			<p style="line-height: 1.5em; margin: 0 0 10px;"><?=$address?></p>
			<h6 style="font-size: 15px; margin: 0 0 10px;">Data</h6>
			<p style="line-height: 1.5em; margin: 0 0 10px;"><?=strftime("%a %e %b %y alle %H:%M" , strtotime($time))?></p>
		</div>
		<hr style="clear:both;margin:30px 0 30px 0">
		
	    <?php else:?>
	    <p style="line-height: 1.5em; margin: 0;">Gentile <?php echo $name." ".$surname;?></p>
	    <p style="line-height: 1.5em; margin: 0;">Qui di seguito è presente l'elenco libri che hai selezionato nel tuo ordine</p>
	    <?php endif;?>
	    <h1 style="font-size: 20px; font-family: 'BebasNeueRegular'; font-weight: normal; margin: 20px 0 10px; padding: 0px;">ELENCO LIBRI</h1>
	    
		<table class="book_list" style="max-width: 2px; border-collapse: collapse; width: 100%; font-size: 10px; text-align: center; border: 1px solid #ccc;">
							<thead>
								<tr class="theader">
									<th style="max-width: 2px; border-collapse: collapse; border: 1px solid #ccc;">Titolo</th>
									<th style="max-width: 2px; border-collapse: collapse; border: 1px solid #ccc;">Autore</th>
									<th style="max-width: 2px; border-collapse: collapse; border: 1px solid #ccc;">Editore</th>
									<th style="max-width: 2px; border-collapse: collapse; border: 1px solid #ccc;">EAN</th>
									<th style="max-width: 2px; border-collapse: collapse; border: 1px solid #ccc;">N.Copie</th>
								</tr>
							</thead>
							<tbody >
							<?php 
							
							
							error_log( $books );
							foreach ($book_list as $b):
								$book = $db->get_book($b['id']);
							?>
							<tr>
								<td style="max-width: 2px; border-collapse: collapse; border: 1px solid #ccc;"><?=$book['title']?></td>
								<td style="max-width: 2px; border-collapse: collapse; border: 1px solid #ccc;"><?=$book['author']?></td>
								<td style="max-width: 2px; border-collapse: collapse; border: 1px solid #ccc;"><?=$book['publisher']?></td>
								<td style="max-width: 2px; border-collapse: collapse; border: 1px solid #ccc;"><?=$book['EAN']?></td>
								<td style="max-width: 2px; border-collapse: collapse; border: 1px solid #ccc;"><?=$b['num_copies']?></td>
							</tr>
							
							<?php endforeach;?>
							</tbody>
							
				</table>
	<?php if ($is_admin):?>
	<a href="<?=site_url();?>admin.php">Accedi al pannello amministratore</a>    
	<?php endif;?>  
</div>
<style type="text/css">
@font-face { font-family: 'BebasNeueRegular' !important; src: url('../fonts/Bebas/BebasNeue-webfontd41d.eot?#iefix') format('embedded-opentype'),url('../fonts/Bebas/BebasNeue-webfont.woff') format('woff'),url('../fonts/Bebas/BebasNeue-webfont.ttf') format('truetype'),url('../fonts/Bebas/BebasNeue-webfont.svg#BebasNeueRegular') format('svg') !important; font-weight: normal !important; font-style: normal !important; }
body { font-size: 12px !important; color: #282828 !important; font-family: Arial, Helvetica, sans-serif !important; background-color: #FFFEF9 !important; margin: 0 !important; line-height: 1.5em !important; background-image: url(../images/style-1/backgrounds/bg-1.jpg) !important; background-repeat: repeat !important; }
</style>

</body>

</html>

